#!/bin/sh /etc/rc.common

START=99
STOP=10

TYPE=$(uci get familycloud.@familycloud[0].speedertype)
TOKEN=$(uci get familycloud.@familycloud[0].token)


start()
{
	stop
	enable=$(uci get familycloud.@familycloud[0].enabled)
	[ $enable -eq 0 ] && exit 0
	sed "s/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/$TOKEN/" /usr/share/familycloud/$TYPE/config.ini > /tmp/config.json
	bash /usr/share/familycloud/$TYPE/speedup.sh > /tmp/familycloud.log &
}

stop()
{
	kill -9 $(ps | grep speedup.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1 
}



